package com.Image.controller;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


import javax.imageio.ImageIO;


import com.Image.util.utiltoor;

public class testImage {
	public static void main(String[] args) {

		File root = new File("F:/穿衣搭配图/photo");
		List<File> files = new ArrayList<File>();
		if (!root.isDirectory()) {
			files.add(root);
		} else { 
			File[] subFiles = root.listFiles();
			for (File f : subFiles) {
				List<File> fileslishi = new ArrayList<File>();
				//files.addAll(utiltoor.getFiles(f.getAbsolutePath()));
				fileslishi.addAll(utiltoor.getFiles(f.getAbsolutePath()));
				//需要删除图片小于750*500的图片
				if(fileslishi.size()>0){
					for(int x=0;x<fileslishi.size();x++){
						BufferedImage bi = null;
						try {
						bi = ImageIO.read(fileslishi.get(x));
						int width = bi.getWidth();
						int height = bi.getHeight();
						if(width*height<400*400){
							fileslishi.get(x).delete();
							System.out.println(fileslishi.get(x).getParentFile()+"过小，删除！。。。。。。。。。。。。。。");
						}else{
							System.out.println(fileslishi.get(x).getParentFile()+",符合，通过！。。。。。。。。。。。。。。");
						}
						} catch (Exception e) {
							e.printStackTrace();
						}finally {
							
						}
					}
				}
			
				
			}
		}
        
	
	}

}
